﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using SRW;
using SRW.BLL;

public partial class system_shiti_showShiti : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int pkID = int.Parse(Request.QueryString["id"].ToString());
            string ProType = SQL.GetData("select wtprotype from wtproblem where pkID=" + pkID + "", "wtprotype");
            if (ProType == "选择题")
            {
                Panel1.Visible = true;
                Panel2.Visible = false;
                LabSelectName.Text = SQL.GetData("select wtproname from wtproblem where pkID=" + pkID + "", "wtproname");
                LabSelectDaRicth.Text = SQL.GetData("select rightname from rightan where problemID=" + pkID + "", "rightname");
                List<Wtanswer> mList = bWtanswer.selectList("select * from wtanswer where problemID=" + pkID + "");
                if (mList.Count >0)
                {
                    if (mList.Count == 2)
                    {
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[0]).wtanname)))
                        {
                            LabSelectDaA.Text = ((Wtanswer)mList[0]).wtanname;
                        }
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[1]).wtanname)))
                        {
                            LabSelectDaB.Text = ((Wtanswer)mList[1]).wtanname;
                        }
                    }
                    else if (mList.Count == 3)
                    {
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[0]).wtanname)))
                        {
                            LabSelectDaA.Text = ((Wtanswer)mList[0]).wtanname;
                        }
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[1]).wtanname)))
                        {
                            LabSelectDaB.Text = ((Wtanswer)mList[1]).wtanname;
                        }
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[2]).wtanname)))
                        {
                            LabSelectDaC.Text = ((Wtanswer)mList[2]).wtanname;
                        }
                    }
                    else if (mList.Count == 4)
                    {
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[0]).wtanname)))
                        {
                            LabSelectDaA.Text = ((Wtanswer)mList[0]).wtanname;
                        }
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[1]).wtanname)))
                        {
                            LabSelectDaB.Text = ((Wtanswer)mList[1]).wtanname;
                        }
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[2]).wtanname)))
                        {
                            LabSelectDaC.Text = ((Wtanswer)mList[2]).wtanname;
                        }
                        if (!(string.IsNullOrEmpty(((Wtanswer)mList[3]).wtanname)))
                        {
                            LabSelectDaD.Text = ((Wtanswer)mList[3]).wtanname;
                        }
                    }
                }
                else
                {
                    Response.Redirect("");
                }
            }
            else
            {
                Panel1.Visible = false;
                Panel2.Visible = true;
                LabPanDName.Text = SQL.GetData("select wtproname from wtproblem where pkID=" + pkID + "", "wtproname");
                List<Rightan> mList = bRightan.selectList("select * from rightan where problemID=" + pkID + "");
                if (mList.Count == 1)
                {
                    LabPanDDa.Text = ((Rightan)mList[0]).rightname;
                }
                else
                {
                    Response.Redirect("");
                }
            }
        }
    }
}
